Blockchain-based data authorization method and apparatus

ABSTRACT

One or more implementations of the present specification provide a blockchain-based data authorization method and apparatus. The method can include receiving, by a blockchain node, an authentication transaction submitted by a privacy computing platform, where the authentication transaction queries whether a data user has obtained authorization of target data possessed by a data owner, and in response to determining that the data user has obtained authorization of the target data, executing, by the blockchain node, a smart contract invoked by the authentication transaction to provide an authorization token to the privacy computing platform that instructs the privacy computing platform to obtain the target data, and send a computational result of one or more predetermined computational operations based on the target data to the data user.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of PCT Application No.PCT/CN2020/072224, filed on Jan. 15, 2020, which claims priority toChinese Patent Application No. 201910703811.0, filed on Jul. 31, 2019,and each application is hereby incorporated by reference in itsentirety.

TECHNICAL FIELD

One or more implementations of the present specification relate to thefield of blockchain technologies, and in particular, to ablockchain-based data authorization method and apparatus.

BACKGROUND

The blockchain technology (also referred to as a distributed ledgertechnology) is a decentralized distributed database technology. Theblockchain technology is characterized by decentralization, openness andtransparency, non-tampering, and trustworthiness, and is applicable to aplurality of application scenarios requiring high data reliability.

SUMMARY

In view of this, one or more implementations of the presentspecification provide a blockchain-based data authorization method andapparatus.

To achieve the previous objective, one or more implementations of thepresent specification provide the following technical solutions:

According to a first aspect of one or more implementations of thepresent specification, a blockchain-based data authorization method isprovided, including: receiving, by a blockchain node, an authenticationtransaction submitted by a privacy computing platform, where theauthentication transaction is used to query whether a data user hasobtained authorization for target data held by a data owner; andexecuting, by the blockchain node, a data authorization smart contractinvoked for the authentication transaction, where the data authorizationsmart contract is used to: when it is confirmed that the data user hasobtained the authorization, provide an authorization token for theprivacy computing platform to instruct the privacy computing platform toobtain the target data, and send, to the data user, at least one of thetarget data or an operation result obtained after a predeterminedoperation is performed on the target data.

According to a second aspect of one or more implementations of thepresent specification, a blockchain-based data authorization method isprovided, including: receiving, by a privacy computing platform, a dataacquisition request initiated by a data user, where the data acquisitionrequest corresponds to target data held by a data owner; submitting, bythe privacy computing platform, an authentication transaction to ablockchain, where the authentication transaction is used to querywhether the data user has obtained authorization for the target data;obtaining, by the privacy computing platform, an authorization tokenissued based on a data authorization smart contract invoked by theauthentication transaction; and obtaining, by the privacy computingplatform, the target data when the authorization token indicates thatthe data user has obtained the authorization for the target data, toreturn, to the data user, at least one of the target data or anoperation result obtained after a predetermined operation is performedon the target data.

According to a third aspect of one or more implementations of thepresent specification, a blockchain-based data authorization apparatusis provided, including: a receiving unit, configured to enable ablockchain node to receive an authentication transaction submitted by aprivacy computing platform, where the authentication transaction is usedto query whether a data user has obtained authorization for target dataheld by a data owner; and an execution unit, configured to enable theblockchain node to execute a data authorization smart contract invokedfor the authentication transaction, where the data authorization smartcontract is used to: when it is confirmed that the data user hasobtained the authorization, provide an authorization token for theprivacy computing platform to instruct the privacy computing platform toobtain the target data, and send, to the data user, at least one of thetarget data or an operation result obtained after a predeterminedoperation is performed on the target data.

According to a fourth aspect of one or more implementations of thepresent specification, a blockchain-based data authorization apparatusis provided, including: a receiving unit, configured to enable a privacycomputing platform to receive a data acquisition request initiated by adata user, where the data acquisition request corresponds to target dataheld by a data owner; a query unit, configured to enable the privacycomputing platform to submit an authentication transaction to ablockchain, where the authentication transaction is used to querywhether the data user has obtained authorization for the target data; anacquisition unit, configured to enable the privacy computing platform toobtain an authorization token issued based on a data authorization smartcontract invoked by the authentication transaction; and a returningunit, configured to enable the privacy computing platform to obtain thetarget data when the authorization token indicates that the data userhas obtained the authorization for the target data, to return, to thedata user, at least one of the target data or an operation resultobtained after a predetermined operation is performed on the targetdata.

According to a fifth aspect of one or more implementations of thepresent specification, an electronic device is provided, including: aprocessor; and a memory, configured to store a processor executableinstruction, wherein the processor implements the method according tothe first aspect by running the executable instruction.

According to a sixth aspect of one or more implementations of thepresent specification, a computer readable storage medium is provided. Acomputer instruction is stored in the computer readable storage medium.When a processor executes the instruction, the steps of the methodaccording to the first aspect are implemented.

According to a seventh aspect of one or more implementations of thepresent specification, an electronic device is provided, including: aprocessor; and a memory, configured to store a processor executableinstruction, wherein the processor implements the method according tothe second aspect by running the executable instruction.

According to an eighth aspect of one or more implementations of thepresent specification, a computer readable storage medium is provided. Acomputer instruction is stored in the computer readable storage medium.When a processor executes the instruction, the steps of the methodaccording to the second aspect are implemented.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram illustrating an example environment,according to an example implementation;

FIG. 2 is a schematic diagram illustrating a conceptual architecture,according to an example implementation;

FIG. 3 is a flowchart illustrating a blockchain-based data authorizationmethod, according to an example implementation;

FIG. 4 is a flowchart illustrating another blockchain-based dataauthorization method, according to an example implementation;

FIG. 5 is a schematic diagram illustrating end-to-end data authorizationimplemented based on a blockchain network, according to an exampleimplementation;

FIG. 6 is an interactive flowchart illustrating end-to-end dataauthorization implemented based on a blockchain network, according to anexample implementation;

FIG. 7 is a schematic diagram illustrating an authorization token,according to an example implementation;

FIG. 8 is an interactive flowchart illustrating another end-to-end dataauthorization implemented based on a blockchain network, according to anexample implementation;

FIG. 9 is a schematic diagram illustrating another end-to-end dataauthorization implemented based on a blockchain network, according to anexample implementation;

FIG. 10 is a schematic structural diagram illustrating a device,according to an example implementation;

FIG. 11 is a block diagram illustrating a blockchain-based dataauthorization apparatus, according to an example implementation;

FIG. 12 is a schematic structural diagram illustrating another device,according to an example implementation; and

FIG. 13 is a block diagram illustrating another blockchain-based dataauthorization apparatus, according to an example implementation.

DESCRIPTION OF IMPLEMENTATIONS

Example implementations will be described here in detail, and examplesof the implementations are shown in the accompanying drawings. When thefollowing description relates to the accompanying drawings, the samenumber in different drawings represents the same element or similarelements, unless otherwise stated. The implementations described in thefollowing example implementations do not represent all implementationsconsistent with one or more implementations of the presentspecification. On the contrary, they are merely examples of devices andmethods consistent with some aspects of one or more implementationsdescribed in detail in the appended claims and the presentspecification.

It is worthwhile to note that the steps of the corresponding method arenot necessarily performed in the order shown and described in thepresent specification in other implementations. In some otherimplementations, the method can include more or less steps than thosedescribed in the present specification. In addition, the steps describedin the present specification can be divided to a plurality of steps fordescription in other implementations; the plurality of steps describedin the present specification can also be combined to a single step fordescription in other implementations.

FIG. 1 is a schematic diagram illustrating an example environment,according to an example implementation. As shown in FIG. 1, an exampleenvironment 100 allows an entity to participate in a blockchain network102. The blockchain network 102 can be a public blockchain network, aprivate blockchain network, or a consortium blockchain network. Exampleenvironment 100 can include computing devices 104, 106, 108, 110, 112,and a network 114. In an implementation, the network 114 can include alocal area network (LAN), a wide area network (WAN), the Internet, or acombination thereof, and the network 114 can be connected to a website,user equipment (for example, a computing device), and a back end system.In an implementation, the network 114 can be accessed by using at leastone of a wired communication method or a wireless communication method.

In some cases, the computing devices 106 and 108 can be nodes (notshown) in a cloud computing system, or each of the computing devices 106and 108 can be a separate cloud computing system, including a pluralityof computers interconnected by a network and operating as a distributedprocessing system.

In an implementation, the computing devices 104 to 108 can run anyproper computing system so that the computing devices can function asnodes in the blockchain network 102. For example, the computing devices104 to 108 can include but are not limited to servers, desktopcomputers, laptops, tablet computing devices, and smart phones. In animplementation, the computing devices 104 to 108 can belong to relevantentities and be used to implement corresponding services. For example,the services can be used to manage transactions of one or more entities.

In an implementation, the computing devices 104 to 108 respectivelystore a blockchain ledger corresponding to the blockchain network 102.The computing device 104 can be (or include) a network server forproviding a browser function. The network server can provide, based onthe network 114, visual information related to the blockchain network102. In some cases, the computing device 104 may not participate inblock verification. Instead, the computing device 104 listens to theblockchain network 102 to determine when other nodes (for example, thenodes can include the computing devices 106 to 108) reach a consensus,thereby generating a corresponding blockchain visual user interface.

In an implementation, the computing device 104 can receive a requestinitiated by a client device (such as the computing device 110 or thecomputing device 112) against the blockchain visual user interface. Insome cases, the node in the blockchain network 102 can also serve as aclient device. For example, a user of the computing device 108 can sendthe previous request to the computing device 104 by using a browserrunning on the computing device 108.

In response to the previous request, the computing device 104 cangenerate the blockchain visual user interface (such as a web page) basedon the stored blockchain ledger and send the generated blockchain visualuser interface to the requesting client device. If the blockchainnetwork 102 is a private or consortium blockchain network, the requestfor the blockchain visual user interface can include user authorizationinformation. Before the blockchain visual user interface is generatedand the user authorization information is sent to the requesting clientdevice, the computing device 104 can verify the user authorizationinformation, and the request can be returned to the correspondingblockchain visual user interface when the user authorization informationpasses the verification.

The blockchain visual user interface can be displayed in a client device(for example, in a user interface 116 shown in FIG. 1). When theblockchain ledger is updated, display content of user interface 116 canalso be updated accordingly. In addition, interaction between a user andthe user interface 116 can result in a request for another userinterface, for example, displaying a block list, block details, atransaction list, transaction details, an account list, account details,a contract list, contract details, or a search result page resultingfrom a user's search for the blockchain network.

FIG. 2 is a schematic diagram illustrating a conceptual architecture,according to an example implementation. As shown in FIG. 2, theconceptual architecture 200 includes a physical layer 202, a hostingservice layer 204, and a blockchain network layer 206. For example, thephysical layer 202 can include three entities: an entity 1, an entity 2,and an entity 3. Each entity has its own transaction management system208.

In an implementation, the hosting service layer 204 can include aninterface 210 corresponding to each transaction management system 208.For example, each transaction management system 208 communicates withthe corresponding interface 210 over a network (such as the network 114in FIG. 1) by using a protocol (such as Hyper Text Transfer ProtocolSecure (HTTPS)). In some examples, each interface 210 can provide acommunication connection between the corresponding transactionmanagement system 208 and the blockchain network layer 206. To bespecific, the interface 210 can communicate with the blockchain network212 of the blockchain network layer 206. In some examples, communicationbetween the interface 210 and the blockchain network layer 206 can beimplemented by using Remote Procedure Calls (RPCs). In some examples,the interface 210 can provide the transaction management system 208 withan API interface for accessing the blockchain network 212.

As described in the present specification, the blockchain network 212 isprovided in the form of a peer-to-peer network. The peer-to-peer networkincludes a plurality of nodes 214, which are respectively configured topermanently store a blockchain ledger 216 formed by blockchain data.FIG. 2 shows only one blockchain ledger 216. However, there can be aplurality of blockchain ledgers 216 or copies of the blockchain ledger216 in the blockchain network 212. For example, each node 214 canmaintain one blockchain ledger 216 or a copy of the blockchain ledger216.

It is worthwhile to note that the transaction described in the presentspecification refers to a piece of data that is created by a userthrough a client of the blockchain and eventually needs to be publishedin a distributed database of the blockchain. The transactions in theblockchain can include a transaction in a narrow sense and a transactionin a broad sense. The transaction in a narrow sense refers to the valuetransfer published to the blockchain by the user. For example, in aconventional bitcoin blockchain network, the transaction can be atransfer initiated by the user in the blockchain. The transaction in abroad sense refers to the business data published to the blockchain bythe user with a business intention. For example, an operator can build aconsortium blockchain based on an actual business requirement, anddeploy, based on the consortium blockchain, other types of onlinebusiness (such as rental business, vehicle scheduling business,insurance claims business, a credit service, a medical service, etc.)that are not related to value transfer. In this type of consortiumblockchain, the transaction can be a business message or a businessrequest with a business intention published by the user in theconsortium blockchain.

Blockchains are generally divided into three types: a public blockchain,a private blockchain, and a consortium blockchain. In addition, thereare many combinations of these types, such as a private blockchain+aconsortium blockchain, and a consortium blockchain+a public blockchain.The public blockchain has the highest degree of decentralization. Thepublic blockchain is represented by bitcoins and Ethereum. Participantsjoining the public blockchain can read a data record on the blockchain,participate in a transaction, and compete for an accounting right of anew block. In addition, participants (that is, nodes) can be free tojoin and exit the network, and perform relevant operations. On thecontrary, for the private blockchain, write permission of the network iscontrolled by a certain organization or institution, and read permissionof data is regulated by an organization. In short, the privateblockchain can be a weakly centralized system that has few strictlylimited participation nodes. This type of blockchain is more suitablefor a particular institution to use internally. The consortiumblockchain is a blockchain between the public blockchain and the privateblockchain, which can implement “partial decentralization”. Each node inthe consortium blockchain usually has its corresponding entityinstitution or organization. Participants join the network afterauthentication, and form a consortium of stakeholders to jointlymaintain the operation of the blockchain.

Whether the blockchain is the public blockchain, the private blockchain,or the consortium blockchain, based on the present specification,collaboration can be implemented between the blockchain network and anoff-chain privacy computing platform. Therefore, secure end-to-end dataauthorization is implemented between a data owner and a data user. Thefollowing describes the technical solutions of the present specificationwith reference to the implementations.

FIG. 3 is a flowchart illustrating a blockchain-based data authorizationmethod, according to an example implementation. As shown in FIG. 3, themethod is applied to a blockchain node and can include the followingsteps:

Step 302: The blockchain node receives an authentication transactionsubmitted by a privacy computing platform. The authenticationtransaction is used to query whether a data user has obtainedauthorization for target data held by a data owner.

The privacy computing platform can directly generate the authenticationtransaction on the previously described blockchain node; or, the privacycomputing platform can generate the authentication transaction on aclient, and send the authentication transaction to the previouslydescribed blockchain node by using the client; or, after generating theauthentication transaction on the client, the privacy computing platformcan send the authentication transaction to another blockchain node, andthe another blockchain node sends the authentication transaction to thepreviously described blockchain node. When a consensus is reached forthe authentication transaction, the authentication transaction istransmitted to all blockchain nodes in the blockchain network, and theauthentication transaction is implemented by each blockchain node.

Although the privacy computing platform can submit the authenticationtransaction at any time to query an authorization state of the data userto the blockchain node, the operation of the privacy computing platformis usually triggered by the data user. For example, when the data userrequests the previous target data from the privacy computing platform,the privacy computing platform submits the authentication transaction tothe blockchain node to determine whether the data user has authorizationfor the target data.

Generally, in the blockchain network using a consensus algorithm such asProof of Work (POW), Proof of Stake (POS), or Delegated Proof of Stake(DPOS), nodes competing for an accounting right can implement theblockchain transaction after receiving the blockchain transaction. Oneof the nodes competing for the accounting right can win in the currentcompetition round, and becomes an accounting node. The previousauthentication transaction is used as an example. The accounting nodecan package the authentication transaction with another transaction togenerate a new block, and send the generated new block to another nodefor consensus.

For a blockchain network using a practical Byzantine Fault Tolerance(PBFT) mechanism, the node with the accounting right has been agreedupon before the current accounting round. Therefore, after receiving theauthentication transaction, the blockchain node can send theauthentication transaction to the accounting node if the blockchain nodeis not the accounting node in the current round. For the accounting node(which can be the previous blockchain node) in the current round, theauthentication transaction can be executed either during or before theauthentication transaction is packaged to generate a new block, orduring or before the authentication transaction is packaged with anothertransaction to generate the new block. After the accounting nodepackages the authentication transaction (or packages the authenticationtransaction with another transactions) to generate the new block, theaccounting node sends the generated new block or a block head to anothernode for consensus.

As previously described, in the blockchain network using a POWmechanism, or in the blockchain network using a POS, DPOS, or and PBFTmechanism, the accounting node in the current round can package theauthentication transaction to generate the new block, and send thegenerated new block and a block head to another node for consensus. Ifthe another node receives the block and determines that the block passesverification, the new block can be added to the end of the originalblockchain, thereby completing the accounting process and reaching aconsensus. If the authentication transaction is used to invoke a dataauthorization smart contract, the data authorization smart contract isinvoked and executed. The authentication transaction in the block canalso be executed when the another node verifies the new block or theblock head sent by the accounting node.

Step 304: The blockchain node executes the data authorization smartcontract invoked for the authentication transaction. The dataauthorization smart contract is used to: when it is confirmed that thedata user has obtained the authorization, provide an authorization tokenfor the privacy computing platform to instruct the privacy computingplatform to obtain the target data, and send, to the data user, at leastone of the target data or an operation result obtained after apredetermined operation is performed on the target data.

The blockchain can provide a function of the smart contract no matterwhether the blockchain is a public blockchain, a private blockchain, ora consortium blockchain. The smart contract on the blockchain can betriggered by a transaction in blockchain system. The smart contract canbe described in the form of codes. The Ethereum is used as an example.The biggest challenge distinguishing the Ethereum from the Bitcoinblockchain technology is that the Ethereum supports the user to createand invoke complex logic in an Ethereum network. The core of aprogrammable blockchain in the Ethereum is the Ethereum Virtual Machine(EVM). Each Ethereum node can run an EVM. The EVM is a Turing completevirtual machine, which means that complex logic can be implementedthrough the EVM. The operation of publishing and invoking the smartcontract in the Ethereum by the user runs on the EVM.

After the data authorization smart contract is created, thecorresponding contract account is formed on the blockchain, and thecontract account has a specific contract address. The authenticationtransaction can include the previous contract address in a field such asthe “to” field of the authentication transaction, to invoke the dataauthorization smart contract. As previously described, after all theblockchain nodes in the blockchain network have reached a consensus,each blockchain node receives the authentication transaction, reads the“to” field of the authentication transaction, and invokes the previousdata authorization smart contract. To be specific, the blockchain nodereads a code of the data authorization smart contract into the EVM onthe blockchain node for execution.

The data authorization smart contract can include a correspondingauthorizer list to record information of an authorized object of thedata held by the data owner, that is, the information of the authorizer.If it is confirmed based on the data authorization smart contract thatthe data user is in the authorizer list, it can be determined that thedata user has obtained the authorization. All data held by the dataowner can be authorized at a time based on a management method of theauthorizer list. In addition, the content of the authorizer list is notaffected even if the data held by the data owner is increased ordecreased, that is, updates of the data held by the data owner iscompatible.

When the data authorization smart contract is created, the informationof the authorizer list can be written into the contract code. Therefore,the content of the authorizer list cannot be changed. Then, replacementor version iteration may need to be performed on the data authorizationsmart contract to update the authorizer list. Alternatively, the dataauthorization smart contract can have one or more corresponding states,and a value of the one or more states can be maintained on theblockchain node. When the value of the state is the information of theauthorizer, the one or more states are equivalent to the previousauthorizer list. The data owner can submit the blockchain transaction tothe blockchain network, and the blockchain transaction can invoke anauthorization interface described in the data authorization smartcontract. Therefore, the content of the authorizer list can be updatedafter the data authorization smart contract is executed withoutperformed replacement or version iteration on the data authorizationsmart contract. Alternatively, the data authorization smart contract caninvoke another smart contract, and a code or a state of the anothersmart contract can be used to record the authorizer list. If theauthorizer list is written into the code of the another smart contractand cannot be changed, when the authorizer list needs to be updated, anew smart contract can be created, a code of the new smart contractincludes the updated authorizer list, and then the data authorizationsmart contract invokes a contract address of the new smart contract (theinvoked contract address can be used as a state of the dataauthorization smart contract, and a value of the state can be changed).If the authorizer list is written into the state corresponding to theanother smart contract, as previously described, the authorizer list canbe updated only by updating the value of the state, and the contractaddress invoked by the data authorization smart contract does not needto be updated. The contract address can be fixedly written into eitherthe code of the data authorization smart contract or the state of thedata authorization smart contract.

The blockchain node can assist the data user in temporarily requestingauthorization from the data owner. For example, the data user can submitan authorization request transaction to the blockchain network. Theauthorization request transaction invokes the request interfacedescribed in the previous data authorization smart contract. Therefore,after the blockchain node executes the authorization requesttransaction, the data authorization smart contract can be written into atransaction log by invoking the request interface described in the dataauthorization smart contract. Then, the data owner can make a responsethrough an event listening responding mechanism when the previousauthorization request event written into the transaction log is listenedto For example, when the data user can obtain authorization, the datauser can submit an authorization conformation transaction to ablockchain network. The authorization conformation transaction invokesthe authorization interface described in the previous data authorizationsmart contract. Therefore, after the blockchain node executes theauthorization conformation transaction, the data user is marked as anauthorized data user based on the data authorization smart contract byinvoking the authorization interface described in the data authorizationsmart contract. Then, the data user usually obtains authorization inadvance through the previous authorization request transaction beforethe authentication transaction is submitted. Certainly, theauthentication transaction can wait for a predetermined time periodduring execution so that the data user can submit the previousauthorization request transaction within the predetermined time period.For another example, the data user does not need to submit the previousauthorization request transaction separately. If the blockchain nodedetermines based on the data authorization smart contract that the datauser does not obtain the authorization for the target data in theprocess of executing the authentication transaction, the authenticationtransaction can also invoke the request interface of the dataauthorization smart contract. Therefore, the authorization request eventis written into the transaction log based on the data authorizationsmart contract, and authorization is temporarily requested to the dataowner through the previous process. Details are omitted here forsimplicity. If the authentication transaction invokes the requestinterface of the data authorization smart contract, the temporaryauthorization request process will not require the participation of thedata user. In other words, it is transparent to the data user. As such,not only the operation of the data user is simplified, but also theexperience of the data user is optimized.

The data user is marked as the authorized data user based on the dataauthorization smart contract. In one case, the data user can be added tothe authorizer list, and the adding process is described previously.Details are omitted here for simplicity. The data held by the data ownercan be obtained through the request at any time provided that the datauser is in the authorizer list, which means that the data user obtainslong-term authorization. In another case, it is confirmed based on thedata authorization smart contract that only the current operation of thedata user obtains the authorization. In this case, the authorized stateof the data user can be cancelled based on the data authorization smartcontract after the authorization token is issued. Therefore, the datauser needs to request authorization from the data owner again at a nexttime to obtain the authorization token. The authorizer list belongs tolong-term authorization in comparison with the latter case describedabove. However, it does not necessarily mean permanent authorization.For example, the data owner can remove one or more authorizers byupdating the authorizer list so that the one or more authorizers losethe authentication. For another example, each authorizer in theauthorizer list can have at least one of specified remainingauthorization duration or a specified quantity of remainingauthorization times. For example, after the authorization token isissued, at least one of the remaining authorization duration or thequantity of remaining authorization times corresponding to the data usercan be decreased based on the data authorization smart contract. In thiscase, the corresponding authorizer can be automatically removed from theauthorizer list when the remaining authorization duration or thequantity of remaining authorization times is cleared, which isequivalent to an “aging” mechanism imposed on the authorizer in theauthorizer list.

The data user can include the information of the target data in theauthorization request transaction, or the privacy computing platform caninclude the information of the target data in the authenticationtransaction. Therefore, the information of the target data can befurther written into the authorization request event in the transactionlog so that the data owner learns of an authorization range that thedata user wishes to obtain. If the authorization request transaction orthe authentication transaction does not include any information of thedata, it indicates that the data user requests authorization to obtainall the data held by the data owner. Correspondingly, the data owner canadd information of the target data to the authorization confirmationtransaction to indicate that authorization is granted to the data userfor the target data. If the authorization confirmation transactionsubmitted by the data owner does not include any data information, itindicates that the data owner grants authorization of all the data tothe data user. Therefore, in some cases, the information of the targetdata included in the authentication transaction may be inconsistent withthe scope of authorization granted to the data user (that is, which datathe data user obtains authentication for). Consequently, the target datacannot be obtained successfully.

The authentication transaction can include description information ofthe target data, for example, a hash value of the target data or anyother description information provided that the description informationcan indicate the target data. For example, the description informationof the target data can be included in the “data” field of a dataacquisition transaction. When the authentication transaction invokes thedata authorization smart contract, content of the “data” field can beused as input information for the data authorization smart contract.Correspondingly, when the authorization token is generated based on thedata authentication smart contract, the description information of thetarget data can be included in the authorization token so that theauthorization token is only used to obtain the target data correspondingto the description information instead of other data. Certainly, theauthentication transaction may not include the description informationof the target data, and include only information of the data ownerinstead. Therefore, the correspondingly generated authorization tokencan be used to obtain any data of the data owner. However, the privacycomputing platform obtains the target data specified by the data userbased on only the authorization token.

The target data can be stored on the blockchain, for example, a databasemaintained by the blockchain node. To prevent the target data fromleakage, usually, it is necessary to encrypt the target data and thenstore the encrypted target data. For example, the data owner can submita depository transaction to the blockchain network. The depositorytransaction includes the encrypted target data. Therefore, afterreceiving the depository transaction, the blockchain node can store theencrypted target data included in the depository transaction. Theencrypted target data is obtained by encrypting the target data by usinga public key of the data owner. Correspondingly, a private key of thedata owner can be hosted on the privacy computing platform so that theprivacy computing platform can read the encrypted target data from thedatabase maintained by the blockchain node, and decrypt the encrypteddata based on the private key of the hosting data owner, to obtain theprevious target data. For another example, the data owner can submit aprivacy depository transaction to the blockchain network. Transactioncontent of the privacy depository transaction is in an encrypted state(which can be implemented through symmetric encryption, asymmetricencryption, digital envelope encryption, etc.), and the transactioncontent includes the target data. Therefore, the blockchain node candecrypt the encrypted transaction content of the privacy depositorytransaction in a trusted execution environment (TEE) to obtain thetransaction content of the privacy depository and obtain the targetdata, encrypt the target data in the TEE by using the public key of thedata owner to obtain the encrypted target data, and store the encryptedtarget data in the database corresponding to the blockchain node.Correspondingly, the private key of the data owner can be hosted on theprivacy computing platform. Therefore, after obtaining the encryptedtarget data, the privacy computing platform can decrypt the encryptedtarget data by using the private key, to obtain the previous targetdata. For still another example, the target data can be generated whenthe blockchain node executes the blockchain transaction in the TEE (forexample, the depository transaction submitted by the data owner), andthe blockchain node can encrypt the generated target data in the TEE byusing the public key of the data owner to obtain the encrypted targetdata, and store the encrypted target data in the database correspondingto the blockchain node. Correspondingly, the private key of the dataowner can be hosted on the privacy computing platform. Therefore, afterobtaining the encrypted target data, the privacy computing platform candecrypt the target data by using the private key.

As described previously, the encryption processing for the target datacan be implemented in combination with the TEE. The target data can beany data requested by the data user and held by the data owner.Therefore, any data held by the data owner can be encrypted by using asimilar method. The TEE is the secure extension based on CPU hardwareand is completely isolated from the outside. The TEE is first putforward by the Global Platform to resolve security isolation ofresources on mobile devices. The TEE is parallel to a trusted secureexecution environment provided by an operating system for anapplication. For example, based on the TEE technologies such as IntelSoftware Protection Extensions (SGX), code execution, remoteattestation, secure configuration, secure storage of data, and a trustedpath for code execution are isolated. Applications running in the TEEare under security protection, and a third party is almost impossible toaccess the applications.

The Intel SGX technology is used as an example. By using a processorinstruction newly added to the CPU, a part of an enclave page cache(EPC) in a memory can be allocated to the blockchain node, and theblockchain node loads the EVM into the EPC and confirms through remoteattestation that the loaded EVM code is consistent with the EVM code ata key management server (for example, through comparing the hashvalues). After the remote attestation is passed, the blockchain nodeencrypts the target data by using a memory encryption engine (MEE) inthe CPU, and stores the encrypted target data into the EPC. Theencrypted content in the EPC can be decrypted into a plaintext onlyafter entering the CPU. In the CPU, the plaintext target data isencrypted to obtain the encrypted target data, and the encrypted targetdata is stored in the database corresponding to the blockchain node.Similarly, the blockchain node can decrypt the encrypted target data inthe TEE. In response to the authentication transaction submitted by theprivacy computing platform, the blockchain node can also execute thedata authorization smart contract in the TEE to generate theauthorization token in the TEE. Therefore, the target data is encryptedin the TEE, the encrypted target data is decrypted in the TEE, and thecode of the data authorization smart contract is executed. As such, asecure and reliable environment can be provided, and interference ofexternal factors can be avoided.

In addition to the database in the blockchain node, the target data canfurther be stored in an off-chain channel by the data owner, and theblockchain node stores only a digital digest of the target data. Forexample, the digital digest can be a hash value of the target data.Then, the privacy computing platform can obtain the target data from theoff-chain channel and provide at least one of the target data or anoperation result for the data user.

After obtaining the target data, the privacy computing platform canprovide the target data directly to the data user. Alternatively, afterobtaining the target data, the privacy computing platform can perform apredetermined operation on the target data and provide the operationresult for the data user. The predetermined operation can be anyoperation desired by the data user. This is not limited in the presentspecification. For example, when the data user initiates a dataacquisition request to the privacy computing platform, requiredoperation rules can be specified in the data acquisition request. Afterlearning the operation rules of the predetermined operation, the privacycomputing platform can implement the predetermined operation on thetarget data based on the operation rules to obtain the correspondingoperation result and provide the operation result to the data user. Whenthe corresponding operation result is obtained after the previouspredetermined operation is performed on the target data, if the datauser cannot derive the value of the target data from the operationresult, the data user can be prevented from directly obtaining thetarget data, while the data acquisition need of the data user is met.Therefore, the following case is avoided: The data user leaks the targetdata, causing infringement to the right of the data owner. As such, thetarget data is always held by the data owner.

There can be different privacy levels among the data held by the dataowner. Correspondingly, data at different privacy levels can beprocessed differently. For example, the data owner can hold data at arelatively low privacy level and data at a relatively high privacy levelseparately, namely, low privacy level data and high privacy level data.Correspondingly, when the target data is at the low privacy level, thetarget data can be provided for the data user, which means that the dataowner does not pay attention to whether the low privacy level data willbe leaked; but when the target data is at the high privacy level, thepredetermined operation needs to be performed on the target data, andthe corresponding operation result is provided for the data user, toensure that the high privacy level data will not be leaked. If thetarget data includes both the low and high privacy level data, the lowprivacy level target data can be provided directly for the data user,and the operation result can be provided to the data user after thepredetermined operation is performed on the high privacy level targetdata. Alternatively, the predetermined operation can be performed on allthe target data, and operation results can be provided for the datauser.

To protect at least one of the target data or the operation result, theprivacy computing platform can transmit at least one of the target dataor the operation result through a data channel (for example, anencrypted data channel) established between the privacy computingplatform and the data user. Alternatively, the privacy computingplatform can encrypt at least one of the target data or the operationresult and transmit at least one of the encrypted target data or theencrypted operation result. When the encryption and the transmission areimplemented, the privacy computing platform can encrypt at least one ofthe target data or the operation result by using the public key of thedata user and transmit at least one of the encrypted target data or theencrypted operation result to the data user. The data user can decryptat least one of the encrypted target data or the encrypted operationresult by using its private key to obtain at least one of the targetdata or the operation result in the plaintext form. Alternatively, theprevious authorization token can include a temporary session key, and atleast one of the target data or the operation result can be encrypted byusing the temporary session key, and then at least one of the encryptedtarget data or the operation result is transmitted by the privacycomputing platform to the data user. The authorization token can includea first field and a second field. Content of the first field is obtainedby encrypting the temporary session key by using a first key (forexample, the public key of the data user) corresponding to the datauser, and content of the second field is obtained by encrypting thetemporary session key by using a second key (for example, the public keyof the privacy computing platform) corresponding to the privacycomputing platform. Therefore, the data user and the privacy computingplatform can separately decrypt the authorization token to obtain thetemporary session key. As such, based on a symmetric encryption scheme,at least one of the target data or the operation result is encrypted,and at least one of the encrypted target data or the encrypted operationresult is transmitted.

Correspondingly, FIG. 4 is a flowchart illustrating anotherblockchain-based data authorization method, according to an exampleimplementation. As shown in FIG. 4, the method is applied to a privacycomputing platform and can include the following steps:

Step 402: The privacy computing platform receives a data acquisitionrequest initiated by a data user, where the data acquisition requestcorresponds to target data held by a data owner.

Step 404: The privacy computing platform submits an authenticationtransaction to a blockchain, where the authentication transaction isused to query whether the data user has obtained authorization for thetarget data.

As described previously, the data user can request the previous targetdata from the privacy computing platform, and the privacy computingplatform can verify an authorization state of the data user bysubmitting the authentication transaction to a blockchain network. Theprivacy computing platform can directly generate the authenticationtransaction on the previous blockchain node; or, the privacy computingplatform can generate the authentication transaction on a client, andsend the authentication transaction to the previous blockchain node byusing the client; or, after generating the authentication transaction onthe client, the privacy computing platform can send the authenticationtransaction to another blockchain node, and the another blockchain nodesends the authentication transaction to the previous blockchain node.When a consensus is reached, the authentication transaction istransmitted to all blockchain nodes in the blockchain network, and theauthentication transaction is executed by each blockchain node.

Step 406: The privacy computing platform obtains an authorization tokenissued based on a data authorization smart contract invoked by theauthentication transaction.

Identification or permission verification is performed on the data userby using the data authorization smart contract on the blockchainnetwork. The privacy computing platform only needs to identify theauthorization token and does not need to pay attention to the datauser's identity or permission. For the process of determining based onthe data authentication smart contract whether the data owner hasobtained authentication, reference can be made to the implementationshown in FIG. 3. Details are omitted here for simplicity.

Step 408: The privacy computing platform obtains the target data whenthe authorization token indicates that the data user has obtained theauthorization for the target data, to return, to the data user, at leastone of the target data or an operation result obtained after apredetermined operation is performed on the target data.

The target data can be stored on a blockchain, for example, stored in adatabase maintained by the blockchain node. To prevent the target datafrom leakage, usually, it is necessary to encrypt the target data andthen store the encrypted target data. For example, the data owner cansubmit a depository transaction to the blockchain network. Thedepository transaction includes the encrypted target data. Therefore,after receiving the depository transaction, the blockchain node canstore the encrypted target data included in the depository transaction.The encrypted target data is obtained by encrypting the target data byusing a public key of the data owner. Correspondingly, a private key ofthe data owner can be hosted on the privacy computing platform so thatthe privacy computing platform can read the encrypted target data fromthe database maintained by the blockchain node, and decrypt theencrypted data based on the private key of the hosting data owner toobtain the previous target data. For another example, the data owner cansubmit a privacy depository transaction to the blockchain network.Transaction content of the privacy depository transaction is in anencrypted state (which can be implemented through symmetric encryption,asymmetric encryption, digital envelope encryption, etc.), and thetransaction content includes the target data. Therefore, the blockchainnode can decrypt the encrypted transaction content of the privacydepository transaction in a trusted execution environment (TEE) toobtain the transaction content of the privacy depository and obtain thetarget data, encrypt the target data in the TEE by using the public keyof the data owner to obtain the encrypted target data, and store theencrypted target data in the database corresponding to the blockchainnode. Correspondingly, the private key of the data owner can be hostedon the privacy computing platform. Therefore, after obtaining theencrypted target data, the privacy computing platform can decrypt theencrypted target data by using the private key, to obtain the previoustarget data. For still another example, the target data can be generatedwhen the blockchain node executes the blockchain transaction in the TEE(for example, the depository transaction submitted by the data owner),and the blockchain node can encrypt the generated target data in the TEEby using the public key of the data owner to obtain the encrypted targetdata, and store the encrypted target data in the database correspondingto the blockchain node. Correspondingly, the private key of the dataowner can be hosted on the privacy computing platform. Therefore, afterobtaining the encrypted target data, the privacy computing platform candecrypt the target data by using the private key.

In addition to the database in the blockchain node, the target data canfurther be stored in an off-chain channel by the data owner, and theblockchain node stores only a digital digest of the target data. Forexample, the digital digest can be a hash value of the target data.Then, the privacy computing platform can obtain the target data from theoff-chain channel and provide at least one of the target data or anoperation result for the data user.

After obtaining the target data, the privacy computing platform canprovide the target data directly to the data user. Alternatively, afterobtaining the target data, the privacy computing platform can perform apredetermined operation on the target data and provide the operationresult for the data user. The predetermined operation can be anyoperation desired by the data user. This is not limited in the presentspecification. For example, when the data user initiates a dataacquisition request to the privacy computing platform, requiredoperation rules can be specified in the data acquisition request. Afterlearning the operation rules of the predetermined operation, the privacycomputing platform can implement the predetermined operation on thetarget data based on the operation rules to obtain the correspondingoperation result and provide the operation result to the data user. Whenthe corresponding operation result is obtained after the previouspredetermined operation is performed on the target data, if the datauser cannot derive the value of the target data from the operationresult, the data user can be prevented from directly obtaining thetarget data, while the data acquisition need of the data user is met.Therefore, the following case is avoided: The data user leaks the targetdata, causing infringement to the right of the data owner. As such, thetarget data is always held by the data owner.

There can be different privacy levels among the data held by the dataowner. Correspondingly, data at different privacy levels can beprocessed differently. For example, the data owner can hold data at arelatively low privacy level and data at a relatively high privacy levelseparately, namely, low privacy level data and high privacy level data.Correspondingly, when the target data is at the low privacy level, thetarget data can be provided for the data user, which means that the dataowner does not pay attention to whether the low privacy level data willbe leaked; but when the target data is at the high privacy level, thepredetermined operation needs to be performed on the target data, andthe corresponding operation result is provided for the data user, toensure that the high privacy level data will not be leaked. If thetarget data includes both the low and high privacy level data, the lowprivacy level target data can be provided directly for the data user,and the operation result can be provided to the data user after thepredetermined operation is performed on the high privacy level targetdata. Alternatively, the predetermined operation can be performed on allthe target data, and operation results can be provided for the datauser.

To protect at least one of the target data or the operation result, theprivacy computing platform can transmit at least one of the target dataor the operation result through a data channel (for example, anencrypted data channel) established between the privacy computingplatform and the data user. Alternatively, the privacy computingplatform can encrypt at least one of the target data or the operationresult and transmit at least one of the encrypted target data or theencrypted operation result. When the encryption and the transmission areimplemented, the privacy computing platform can encrypt at least one ofthe target data or the operation result by using the public key of thedata user and transmit at least one of the encrypted target data or theencrypted operation result to the data user. The data user can decryptat least one of the encrypted target data or the encrypted operationresult by using its private key to obtain at least one of the targetdata or the operation result in the plaintext form. Alternatively, theprevious authorization token can include a temporary session key, and atleast one of the target data or the operation result can be encrypted byusing the temporary session key, and then at least one of the encryptedtarget data or the operation result is transmitted by the privacycomputing platform to the data user. The authorization token can includea first field and a second field. Content of the first field is obtainedby encrypting the temporary session key by using a first key (forexample, the public key of the data user) corresponding to the datauser, and content of the second field is obtained by encrypting thetemporary session key by using a second key (for example, the public keyof the privacy computing platform) corresponding to the privacycomputing platform. Therefore, the data user and the privacy computingplatform can separately decrypt the authorization token to obtain thetemporary session key. As such, based on a symmetric encryption scheme,at least one of the target data or the operation result is encrypted,and at least one of the encrypted target data or the encrypted operationresult is transmitted.

It is worthwhile to note that the “data” held by the data owner andrequested by the data user in the present specification should beunderstood as a generalized concept, for example, a value, a word, animage, an audio, a video, a code, a program, or a model (such as anartificial intelligence model). This is not limited in the presentspecification.

FIG. 5 is a schematic diagram illustrating end-to-end data authorizationimplemented based on a blockchain network, according to an exampleimplementation. As shown in FIG. 5, assuming that nodes such as N1, N2,N3, N4 and N5 exist in the blockchain network, the blockchain networkcan be a consortium blockchain formed by service platforms and severalpartners. For example, in a supply chain financial scenario, the nodesN1, N2, N4, and N5 correspond directly or indirectly to a plurality ofsupply chain financial enterprises. The node N3 corresponds to a serviceplatform, and a user can obtain target data of each supply chainfinancial enterprise based on the service platform or obtain anoperation result based on the target data. For another example, in aninvoice scenario, the nodes N1, N2, N4, and N5 correspond directly orindirectly to a plurality of merchants, the node N3 corresponds to theservice platform, and a user can obtain invoices issued by variousmerchants, and obtain a part of information in the invoices based on theservice platform or an operation result based on the invoiceinformation. Certainly, the technical solution of the presentspecification can also be applied to other scenarios. This is notlimited in the present specification. For ease of understanding, theinvoice scenario is used as an example for description.

Assuming that a user Ua (can be an individual or an institution) wishesto obtain, from a merchant CC, invoices issued within the latest month,based on the technical solution of the present specification, the userUa can obtain these invoices conveniently and guarantee the security ofthese invoices. For example, FIG. 6 is an interactive flowchartillustrating end-to-end data authorization implemented based on ablockchain network, according to an example implementation. As shown inFIG. 6, the interactive process between a user Ua, the blockchain node,a merchant CC, and an off-chain platform can include the followingsteps:

Step 601: The user Ua generates an authorization request transaction andsubmits the authorization request transaction to the blockchain network.

A client can run on a computing device used by the user Ua, and theauthorization request transaction can be generated based on the clientand then submitted to the blockchain network. Alternatively, aftergenerating the authorization request transaction on the client, the userUa can upload the authorization request transaction to a serviceplatform so that the service platform submits the authorization requesttransaction to the blockchain network. Alternatively, the user Ua caninitiate an authorization request to the service platform so that theservice platform generates the authorization request transaction andsubmits the authorization request transaction to the blockchain network.

The purpose of submitting the authorization request transaction to theblockchain network is to request the merchant CC to grant the relevantauthorization to the user Ua so that the user Ua can eventually obtainthe invoices issued within the latest month. The authorization requesttransaction can include data description information to describe datathat the user Ua wishes to request authorization from the merchant CCseparately. For example, the data description information can be used todescribe the invoices issued within the latest month by the merchant CC.Correspondingly, the user Ua can obtain authorization of the invoicesissued within the latest month by the merchant CC instead ofauthorization of other data. Alternatively, the authorization requesttransaction may not include the data description information, whichindicates that the user Ua wishes to request authorization for all dataseparately from the merchant CC. As such, the user Ua obtainsauthorization for all the data held by the merchant CC, including theinvoices issued within the latest month. The data descriptioninformation included in the authorization request transaction is used asan example to describe subsequent steps.

The authorization request transaction is initially submitted to acertain node in the blockchain network, such as the node N3 or anothernode shown in FIG. 5. After the authorization request transaction issubmitted to the blockchain network, a consensus can be reached betweennodes, and after the consensus is reached, the authorization requesttransaction can be executed on each node. The consensus process can usePOW, POS, DPOS, PBFT, or another consensus mechanism in relevanttechnologies. This is not limited in the present specification.

Step 602: The blockchain node invokes a request interface of the smartcontract TT to assist the user Ua in obtaining the data authorizationand write an authorization request event into a transaction log.

After reaching the consensus, each node in the blockchain network needsto execute the previous authorization request transaction. Whenexecuting the authorization request transaction, the blockchain nodeinvokes the smart contract TT by reading an account address filled inthe “to” field for the authorization request transaction. The code ofthe smart contract TT can logically form a plurality of interfaces torespectively realize different functions, and the interface to beinvoked can be specified in the authorization request transaction. Forexample, when the request interface of the smart contract TT is invokedin the authorization request transaction, relevant authorization can berequested correspondingly.

For example, the authorization request transaction can include theprevious data description information, information of the user Ua (forexample, a signature of the user Ua), information of the merchant CC(for example, a public key of the merchant CC), etc. Therefore, afterthe request interface of the smart contract TT is invoked, theauthorization request event can be written into the transaction log ofthe authorization request transaction. Content of the authorizationrequest event can include the previous data description information, theinformation of the user Ua, the information of the merchant CC, etc.,which indicates that the user Ua wishes to obtain the target datacorresponding to the data description information from the merchant CC.

Step 603: The merchant CC listens to the authorization request event.

Because operations of all the blockchain nodes are consistent, themerchant CC can learn the previous authorization request event based onevent listening mechanism by accessing any corresponding blockchainnode, to determine the target data that user Ua wishes to obtain fromthe merchant CC.

Step 604: The merchant CC generates an authorization confirmationtransaction and submits the authorization confirmation transaction tothe blockchain network.

When the merchant CC agrees the user Ua to obtain the relevant targetdata, the authorization confirmation transaction can be generated andsubmitted separately to indicate that the merchant CC agrees to providethe user Ua with the target data such as the invoices issued within thelatest month. The merchant CC is used as an example. The authorizationconfirmation transaction generated by the merchant CC can include thedata description information corresponding to the target data that themerchant CC agrees to provide for the user Ua, the public key of theuser Ua, and a signature of merchant CC. Alternatively, theauthorization confirmation transaction can include information such as atransaction number of the previous authorization request transaction toindicate that the merchant CC agrees a relevant request of theauthorization request transaction.

Step 605: The blockchain node invokes the authorization interface of thesmart contract TT, updates an authorization state of the user Ua, andwrites an authorization state update event into the transaction log.

As describe previously, the smart contract TT includes severalpre-described interfaces. In the authorization confirmation transactionsubmitted by the merchant CC, the “to” field can include a contractaddress of the smart contract TT, and can indicate that theauthorization interface is expected to be invoked. The codecorresponding to the authorization interface is run so that it can beconfirmed based on the smart contract TT that the merchant CC agrees togrant authorization of the target data such as the invoices issuedwithin the latest month to the user Ua, separately. Therefore, anauthorization state of the user Ua is updated to an authorized state. Asdescribe previously, the authorized state of the user Ua can be recordedin a plurality of forms, depending on rules described in the smartcontract TT. Details are omitted here for simplicity.

For update condition of the authorization state of the user Ua, acorresponding authorization state update event can be written into thetransaction log based on the smart contract TT, to indicate that theuser Ua has obtained the authorization for the invoices issued withinthe latest month by the merchant CC.

Step 606: The user Ua listens to the authorization state update event.

Similarly to step 603, the user Ua can listen to the transaction logcorresponding to the authorization confirmation transaction in theblockchain node based on the event listening mechanism, and determinebased on the authorization state update event obtained through listeningthat the user Ua has obtained authorization for the invoices issuedwithin the latest month by the merchant CC.

Step 607: The user Ua generates a data acquisition request and initiatesthe data acquisition request to an off-chain platform.

The data acquisition request can include the data descriptioninformation to describe that the user Ua wishes to obtain, from themerchant CC, the invoices issued within the latest month. Alternatively,the data acquisition request can include the previous transaction numberof the authorization request transaction or the previous transactionnumber of the authorization confirmation transaction, and can alsoindirectly indicate that the user Ua wishes to obtain, from the merchantCC, the invoices issued within the latest month.

Step 608: The off-chain platform generates an authentication transactionand submits the authentication transaction to the blockchain network.

A client can run on the off-chain platform, and the authenticationtransaction can be generated based on the client and then submitted tothe blockchain network. Alternatively, after generating theauthentication transaction on the client, the off-chain platform canupload the authentication transaction to a service platform so that theservice platform submits the authentication transaction to theblockchain network. Alternatively, the off-chain platform can initiatean authentication request to the service platform so that the serviceplatform generates the authentication transaction and submits theauthentication transaction to the blockchain network.

Step 609: The blockchain node invokes a data interface of the smartcontract TT, generates an authorization token, and adds theauthorization token to the transaction log.

The data interface of the smart contract TT can be invoked to indicateto the smart contract TT that the user Ua wishes to obtain the invoicesissued within the latest month by the merchant CC. Then, theauthorization state of the user Ua can be queried based on the smartcontract TT.

If the user Ua does not obtain authorization, the transaction can beterminated. If the user Ua has obtained authorization, the authorizationtoken can be generated based on the smart contract TT so that the userUa can obtain the invoices issued within the latest month by themerchant CC. FIG. 7 is a schematic diagram of an authorization token,according to an example implementation. As shown in FIG. 7, anauthorization token can include several fields such as a user ID, ENC(K_(Ua), K_(TEMP)), ENC (K_(M), K_(TEMP)), authorization content, a TAG,etc. Certainly, content of the authorization token can varyappropriately with a scenario difference. Details are omitted here forsimplicity.

The user ID field can include an ID of a user Ua. If the authorizationtoken is obtained by a user Ub and the user Ub provides theauthorization token for the off-chain platform, the chain platform candetermine that the authorization token is not verified because the userID included in the authorization token belongs to the user Ua differentfrom user Ub, namely, the authorization token is invalid. In theprevious process, the off-chain platform submits an authenticationtransaction based on the data acquisition request initiated by the userUa and obtains the authorization token, which means that theauthorization token is provided by the user Ua for the off-chainplatform. Because the user ID field of the authorization token includesthe ID of the user Ua, it can be determined that the provider of theauthorization token is consistent with the authorization token, and theauthorization token is valid. In addition, after obtaining theauthorization token, the off-chain platform can provide, based on theuser ID included in the authorization token, the authorization token forthe user corresponding to the user ID. For example, in theimplementation shown in FIG. 6, the authorization token should beprovided for the user Ua so that the user Ua can obtain a temporary keyK_(TEMP) accordingly.

ENC (K_(Ua), K_(TEMP)) means an encrypted result obtained afterencrypting K_(Ua) and K_(TEMP) by using a predetermined algorithm.K_(Ua) is a key corresponding to the user Ua, and K_(TEMP) is thetemporary key generated for the data authorization based on the smartcontract TT. K_(Ua) is kept by the user Ua so that the user Ua candecrypt ENC (K_(Ua), K_(TEMP)) based on the key K_(Ua) to obtain thetemporary key K_(TEMP).

ENC (K_(M), K_(TEMP)) means an encrypted result obtained afterencrypting K_(M) and K_(TEMP) by using a predetermined algorithm. K_(M)is a key corresponding to the off-chain platform, and K_(TEMP) is thetemporary key generated for the data authorization based on the smartcontract TT. K_(M) is kept by the off-chain platform so that the chainplatform can decrypt ENC (K_(M), K_(TEMP)) based on the key K_(M) toobtain the temporary key K_(TEMP).

The authorization content can include the previous data descriptioninformation to describe data for which the user Ua obtain authorization.For example, in the implementation shown in FIG. 6, authorized contentcan be the invoices issued within the latest month by the merchant CC.

The TAG field is used to verify content integrity and authenticity ofthe authorization token. In addition to the TAG field, assuming thatcontent of fields such as the user ID, ENC (K_(Ua), K_(TEMP)), ENC(K_(M), K_(TEMP)), and authorization content are all called MG, thecontent of the TAG field can include MAC=C(K_(M), MG), that is, aMessage Authentication Code (MAC) generated based on the key and thecontent MG. Here, C ( ) represents the adopted generation function.After receiving the authorization token, the off-chain platform canverify, based on the key K_(M) and the MAC included in the TAG field,other fields included in the authorization token, to determine whethercontent MG is tampered or the data is lost or damaged duringtransmission.

Step 610: The off-chain platform listens to a transaction executionresult event.

As described previously, the off-chain platform can listen to thetransaction log of the data acquisition transaction based on the eventlistening responding mechanism to obtain the transaction executionresult event. If the data acquisition transaction is successfullyimplemented, the off-chain platform can obtain the authorization tokenfrom the transaction execution result event.

Step 611: The off-chain platform obtains encrypted invoices from theblockchain, decrypts the encrypted invoices, and returns the invoices tothe user Ua.

The encrypted invoices are stored on the blockchain so that theoff-chain platform can access any blockchain node in the blockchainnetwork and obtain the encrypted invoices. Actually, because all thedata stored on the blockchain network are in a public state, theplatform can randomly access the data stored on the blockchain network.The off-chain platform can even synchronize the data on the blockchainnetwork to the off-chain platform so that after obtaining the previousauthorization token, the off-chain platform can directly obtain theencrypted invoices locally without temporarily accessing the blockchainnetwork. As such, a response speed can be accelerated and the waitingtime of the user Ua can be shortened.

The invoices can be encrypted by using the public key of the merchant CCto obtain the previous encrypted invoices. The encrypted invoices can bedecrypted only by using the private key of the merchant CC. The privatekey is not in the public state. Therefore, even if the encryptedinvoices can be randomly accessed, it can be ensured that the invoicesof the merchant CC are in a secure state. To meet a demand of anauthorized user for invoices and reduce processing pressure on themerchant CC, the off-chain platform can provide a private key hostingservice to the merchant CC. Therefore, the merchant CC can host theprivate key securely on the off-chain platform, then the off-chainplatform can decrypt the encrypted invoice directly and provide theinvoices obtained after the decryption to a data user such as the userUa.

After obtaining the plaintext invoices through decryption, the off-chainplatform can encrypt the invoices by using the previous temporary keyK_(TEMP) and transmit the encrypted invoices to the user Ua.Correspondingly, the user Ua can use the temporary key K_(TEMP) todecrypt the received transmission data to obtain the invoices issuedwithin the latest month by the merchant CC, thereby ensuring secure datatransmission between the off-chain platform and the user Ua.

In the implementation shown in FIG. 6, the user Ua needs to submit theauthorization request transaction to the blockchain network separately.Therefore, the blockchain node assists the user Ua to obtainauthorization from the merchant CC, and then the user Ua initiates thedata acquisition request to the off-chain platform to obtain theinvoices issued within the latest month by the merchant CC. In anotherimplementation, the related operation of the user Ua can be simplified,and the user Ua can still obtain the invoices issued within the latestmonth by the merchant CC. Description is provided below with referenceto FIG. 8. FIG. 8 is an interactive flowchart illustrating anotherend-to-end data authorization implemented based on a blockchain network,according to an example implementation. As shown in FIG. 8, theinteractive process among a user Ua, a blockchain node, a merchant CC,and an off-chain platform can include the following steps:

Step 801: The user Ua generates a data acquisition request and initiatesthe data acquisition request to the off-chain platform.

The data acquisition request can include data description information todescribe that the user Ua wishes to obtain invoices issued within thelatest month by the merchant CC.

Step 802: The off-chain platform generates an authentication transactionand submits the authentication transaction to a blockchain network.

A client can run on the off-chain platform, and the authenticationtransaction can be generated based on the client and then submitted tothe blockchain network. Alternatively, after generating theauthentication transaction on the client, the off-chain platform canupload the authentication transaction to a service platform so that theservice platform submits the authentication transaction to theblockchain network. Alternatively, the off-chain platform can initiatean authentication request to the service platform so that the serviceplatform generates the authentication transaction and submits theauthentication transaction to the blockchain network.

The purpose of submitting the authentication transaction to theblockchain network is to determine whether the user Ua obtainsauthorization related to the target data requested by the user Ua. Ifyes, the procedure can skip to step 808, or proceed to step 803.

The authentication transaction is initially submitted to a certain nodein the blockchain network, such as the node N3 or another node shown inFIG. 5. After the authentication transaction is submitted to theblockchain network, a consensus can be reached between nodes, and afterthe consensus is reached, the authentication transaction can be executedon each node. The consensus process can use POW, POS, DPOS, PBFT, oranother consensus mechanism in relevant technologies. This is notlimited in the present specification.

Step 803: The blockchain node invokes a request interface of the smartcontract TT to assist the user Ua in obtaining the data authorizationand write an authorization request event into a transaction log.

After reaching the consensus, each node in the blockchain network needsto execute the previous authentication transaction. When executing theauthentication transaction, the blockchain node invokes the smartcontract TT by reading an account address filled in the “to” field forthe authentication transaction. The code of the smart contract TT canlogically form a plurality of interfaces to respectively realizedifferent functions, and the interface to be invoked can be specified inthe authentication transaction. For example, when the request interfaceof the smart contract TT is invoked in the authentication transaction,relevant authorization can be requested correspondingly.

For example, the authentication transaction can include the previousdata description information, information of the user Ua (for example, asignature of the user Ua), information of the merchant CC (for example,a public key of the merchant CC), etc. Therefore, after the requestinterface of the smart contract TT is invoked, the authorization requestevent can be written into the transaction log of the authenticationtransaction. Content of the authorization request event can include theprevious data description information, the information of the user Ua,the information of the merchant CC, etc., which indicates that the userUa wishes to obtain the target data corresponding to the datadescription information from the merchant CC instead of authorization ofother data. Alternatively, the authorization request event may notinclude the data description information, which indicates that the userUa wishes to request authorization for all data separately from themerchant CC. As such, the user Ua obtains authorization for all the dataheld by the merchant CC, including the invoices issued within the latestmonth. The data description information included in the authorizationrequest event is used as an example to describe subsequent steps.

Step 804: The merchant CC listens to the authorization request event.

Because operations of all the blockchain nodes are consistent, themerchant CC can learn the previous authorization request event based onevent listening mechanism by accessing any corresponding blockchainnode, to determine the target data that user Ua wishes to obtain fromthe merchant CC.

Step 805: The merchant CC generates an authorization confirmationtransaction and submits the authorization confirmation transaction tothe blockchain network.

When the merchant CC agrees the user Ua to obtain the relevant targetdata, the authorization confirmation transaction can be generated andsubmitted separately, to indicate that the merchant CC agrees to providethe user Ua with the target data such as the invoices issued within thelatest month. The merchant CC is used as an example. The authorizationconfirmation transaction generated by the merchant CC can include thedata description information corresponding to the target data that themerchant CC agrees to provide for the user Ua, the public key of theuser Ua, and a signature of merchant CC. Alternatively, theauthorization confirmation transaction can include information such as atransaction number of the previous authorization request transaction, toindicate that the merchant CC agrees a relevant request of theauthorization request transaction.

Step 806: The blockchain node invokes the authorization interface of thesmart contract TT, updates an authorization state of the user Ua, andwrites an authorization state update event into the transaction log.

As describe previously, the smart contract TT includes severalpre-described interfaces. In the authorization confirmation transactionsubmitted by the merchant CC, the “to” field can include a contractaddress of the smart contract TT, and can indicate that theauthorization interface is expected to be invoked. The codecorresponding to the authorization interface is run so that it can beconfirmed based on the smart contract TT that the merchant CC agrees togrant authorization of the target data such as the invoices issuedwithin the latest month to the user Ua, separately. Therefore, anauthorization state of the user Ua is updated to an authorized state. Asdescribe previously, the authorized state of the user Ua can be recordedin a plurality of forms, depending on rules described in the smartcontract TT. Details are omitted here for simplicity.

For update condition of the authorization state of the user Ua, acorresponding authorization state update event can be written into thetransaction log based on the smart contract TT to indicate that the userUa has obtained the authorization for the invoices issued within thelatest month by the merchant CC.

Step 807: The blockchain node invokes a data interface of the smartcontract TT, generates an authorization token, and adds theauthorization token to the transaction log.

The authorization token can be generated based on the smart contract TTby invoking the data interface of the smart contract TT. As such, theuser Ua can obtain the invoices issued within the latest month by themerchant CC. For a related structure of the authorization token and ameaning and a function of each field, references can be made to theprevious description with reference to FIG. 7. Details are omitted herefor simplicity.

Step 808: The off-chain platform listens to a transaction executionresult event.

As described previously, the off-chain platform can listen to thetransaction log of the data acquisition transaction based on the eventlistening responding mechanism to obtain the transaction executionresult event. If the data acquisition transaction is successfullyimplemented, the off-chain platform can obtain the authorization tokenfrom the transaction execution result event.

Step 809: The off-chain platform obtains encrypted invoices from theblockchain, decrypts the encrypted invoices, and returns the invoices tothe user Ua.

The encrypted invoices are stored on the blockchain so that theoff-chain platform can access any blockchain node in the blockchainnetwork and obtain the encrypted invoices. Actually, because all thedata stored on the blockchain network are in a public state, theplatform can randomly access the data stored on the blockchain network.The off-chain platform can even synchronize the data on the blockchainnetwork to the off-chain platform so that after obtaining the previousauthorization token, the off-chain platform can directly obtain theencrypted invoices locally without temporarily accessing the blockchainnetwork. As such, a response speed can be accelerated and the waitingtime of the user Ua can be shortened.

The invoices can be encrypted by using the public key of the merchant CCto obtain the previous encrypted invoices. The encrypted invoices can bedecrypted only by using the private key of the merchant CC. The privatekey is not in the public state. Therefore, even if the encryptedinvoices can be randomly accessed, it can be ensured that the invoicesof the merchant CC are in a secure state. To meet a demand of anauthorized user for invoices and reduce processing pressure on themerchant CC, the off-chain platform can provide a private key hostingservice to the merchant CC. Therefore, the merchant CC can host theprivate key securely on the off-chain platform, then the off-chainplatform can decrypt the encrypted invoice directly and provide theinvoices obtained after the decryption to a data user such as the userUa.

After obtaining the plaintext invoices through decryption, the off-chainplatform can encrypt the invoices by using the previous temporary keyK_(TEMP) and transmit the encrypted invoices to the user Ua.Correspondingly, the user Ua can use the temporary key K_(TEMP) todecrypt the received transmission data to obtain the invoices issuedwithin the latest month by the merchant CC, thereby ensuring secure datatransmission between the off-chain platform and the user Ua.

In the implementation shown in FIG. 5 to FIG. 8, the data held by thedata owner is encrypted by using the public key, and the encrypted datais stored in the blockchain network, for example, in a block (includedin the transaction content) or a local database maintained by ablockchain node. The chain platform can directly provide the data userwith the data needed by the data user by hosting the private key of thedata owner on the off-chain platform. In other implementations, the dataowner can store the relevant data in off-chain storage space rather thanin the blockchain network. In this case, the off-chain platform needs totrade with the off-chain storage space to obtain corresponding targetdata. For example, FIG. 9 is a schematic diagram illustrating anotherend-to-end data authorization implemented based on a blockchain network,according to an exemplary implementation. As shown in FIG. 9, therelevant structure of the blockchain network is similar to that in FIG.5. Details are omitted here for simplicity. It is assumed that the userUa wishes to obtain an average invoice amount of invoices issued withinlast three months by the merchant CC. In this case, there are twomethods: (1) The invoices issued within last three months by themerchant CC are provided for the user Ua so that the user Ua calculatesthe average invoice amount; and (2) the merchant CC calculates theaverage invoice amount of the invoices issued within the last threemonths by the merchant CC and provides only the average invoice amountfor the user Ua.

The method (1) is similar to the implementations shown in FIG. 5 to FIG.8, while some differences exist in the interactive process in FIG. 9. Asshown in FIG. 9, an off-chain platform 91 can obtain an authorizationtoken through steps 601 to 610 in FIG. 6 or steps 801 to 808 in FIG. 8.An authorization content field of the authorization token describes theinvoices issued within the last three months by the merchant CC. Then,the off-chain platform 91 can request chain storage space 92 to obtainthe invoices issued within the last three months by the merchant CC. Theoff-chain storage space 92 can be maintained by the merchant CC or byanother object other than the merchant CC. Then, off-chain platform 91encrypts the invoice data based on the temporary key K_(TEMP) describedpreviously and transmits the encrypted invoice data to the user Ua.After decrypting the invoice data by using the temporary key K_(TEMP),the user Ua can further calculate the obtained invoice data to obtainthe corresponding average invoice amount.

The method (2) is much different. As shown in FIG. 9, the user Ua canobtain the authorization token through steps 601 to 610 in FIG. 6 orsteps 801 to 808 in FIG. 8. The authorization content field of theauthorization token describes the average invoice amount of the invoicesissued within the last three months by the merchant CC. Then, theoff-chain platform 91 can request the chain storage space 92 to obtainthe invoices issued within the last three months by the merchant CC. Theoff-chain platform 91 calculates the corresponding average invoiceamount based on these invoices. Finally, the off-chain platform 91encrypts the average invoice amount based on the temporary key K_(TEMP)described previously and transmits the encrypted amount to the user Ua.After decrypting the encrypted amount by using the temporary keyK_(TEMP), the user Ua can obtain the average invoice amount. Based onthe method (2), the user Ua can obtain the value of the average invoiceamount, while an invoice amount of each invoice is not exposed to theuser Ua. As such, a requirement of the user Ua can be satisfied, anddata of the merchant CC can be prevented from leakage. In particular,the user Ua can be prevented from further providing the invoice toanother user after obtaining the invoice, thereby ensuring that the dataheld by the merchant CC is in a secure and controllable state.

The processing method used in the method (2) can also be applied to theimplementations shown in FIG. 5 to FIG. 8. For example, the off-chainplatform 50 can obtain, from the blockchain network, the encrypted datacorresponding to the invoices issued within the last three months by themerchant CC, and decrypt the encrypted data by using the hosted privatekey to obtain the plaintext invoices. Then the off-chain platform 50obtains, through calculation, the average invoice amount of invoicesissued within the last three months by the merchant CC, and provides theaverage invoice amount for the user Ua. Therefore, the following case isavoided: The user Ua gets direct access to the invoices issued withinthe last three months by the merchant CC.

FIG. 10 is a schematic structural diagram illustrating a device,according to an example implementation. With reference to FIG. 10, froma hardware perspective, the device includes a processor 1002, aninternal bus 1004, a network interface 1006, a memory 1008 and anon-volatile memory 1010. The device can further include hardwarerequired for other services. The processor 1002 reads a correspondingcomputer program from the non-volatile memory 1010 to the memory 1008,and runs the computer program. Therefore, a blockchain-based dataauthorization device is formed from a logical perspective. Certainly, inaddition to the software implementation, one or more implementations ofthe present specification do not preclude other implementations, forexample, a logic device or a combination of software and hardware. Inother words, the execution entity of the following processing procedureis not limited to each logical unit, and can alternatively be hardwareor a logical device.

With reference to FIG. 11, in a software implementation, theblockchain-based data authorization apparatus can include the following:a receiving unit 1101, configured to enable a blockchain node to receivean authentication transaction submitted by a privacy computing platform,where the authentication transaction is used to query whether a datauser has obtained authorization for target data held by a data owner;and an execution unit 1102, configured to enable the blockchain node toexecute a data authorization smart contract invoked for theauthentication transaction, where the data authorization smart contractis used to: when it is confirmed that the data user has obtained theauthorization, provide an authorization token for the privacy computingplatform to instruct the privacy computing platform to obtain the targetdata, and send, to the data user, at least one of the target data or anoperation result obtained after a predetermined operation is performedon the target data.

Optionally, the data authorization smart contract corresponds to anauthorizer list, and when it is confirmed that the data user is in theauthorizer list, it is confirmed based on the data authorization smartcontract that the data user has obtained the authorization.

Optionally, the apparatus further includes the following: a requestingunit 1103, configured to enable the blockchain node to invoke a requestinterface described in the data authorization smart contract, so that anauthorization request event is written into a transaction log based onthe data authorization smart contract for the data owner to listen; andan authorization unit 1104, configured to enable the blockchain node toinvoke, based on an authorization confirmation transaction submitted bythe data owner, an authorization interface described in the dataauthorization smart contract so that it is confirmed based on the dataauthorization smart contract that the data user has obtained theauthorization.

Optionally, the requesting unit 1103 is configured to: enable theblockchain node to invoke the request interface described in the dataauthorization smart contract in response to the authenticationtransaction; or enable the blockchain node to invoke the requestinterface described in the data authorization smart contract based on anauthorization request transaction submitted by the data user.

Optionally, the data authorization smart contract is further used tocancel an authorized state of the data user after the authorizationtoken is issued; or the data authorization smart contract is furtherused to decrease a quantity of remaining authorization timescorresponding to the data user after the authorization token is issued.

Optionally, when the target data is at a low privacy level, the targetdata is provided for the data user; when the target data is at a highprivacy level, the predetermined operation is performed on the targetdata so that a corresponding operation result is provided for the datauser.

Optionally, the apparatus further includes the following: a storage unit1105, configured to enable the blockchain node to store encrypted targetdata included in a depository transaction after the depositorytransaction is received, where the encrypted target data is obtainedafter the target data is encrypted by using a public key of the dataowner, and a private key of the data owner is hosted on the privacycomputing platform so that the privacy computing platform decrypts theencrypted target data after obtaining the encrypted target data, toobtain the target data.

Optionally, the apparatus further includes the following: an encryptionunit 1106, configured to enable the blockchain node to encrypt thetarget data in a trusted execution environment by using the public keyof the data owner to obtain encrypted target data, to store theencrypted target data in a database corresponding to the blockchainnode, where a private key of the data owner is hosted on the privacycomputing platform so that the privacy computing platform decrypts theencrypted target data after obtaining the encrypted target data, toobtain the target data.

Optionally, the apparatus further includes the following: a decryptionunit 1107, configured to enable the blockchain node to decrypt a privacydepository transaction in the trusted execution environment after theprivacy depository transaction submitted by the data owner is received,to obtain the target data included in the transaction content; or agenerating unit 1108, configured to enable the blockchain node toexecute corresponding transaction content in the trusted executionenvironment after a depository transaction submitted by the data owneris received, to generate the target data.

Optionally, the blockchain node stores a digital digest of the targetdata, the target data is stored in an off-chain channel by the dataowner, and the target data is obtained by the privacy computing platformfrom the off-chain channel.

Optionally, the authorization token includes a temporary session key,and at least one of encrypted target data or an encrypted operationresult is transmitted by the privacy computing platform to the data userafter at least one of the target data or the operation result isencrypted by using the temporary session key.

Optionally, the authorization token includes a first field and a secondfield, content of the first field is obtained by encrypting thetemporary session key by using a first key corresponding to the datauser, and content of the second field is obtained by encrypting thetemporary session key by using a second key corresponding to the privacycomputing platform.

FIG. 12 is a schematic structural diagram illustrating a device,according to an example implementation. With reference to FIG. 12, froma hardware perspective, the device includes a processor 1202, aninternal bus 1204, a network interface 1206, a memory 1208 and anon-volatile memory 1210. The device can further include hardwarerequired for other services. The processor 1202 reads a correspondingcomputer program from the non-volatile memory 1210 to the memory 1208,and runs the computer program. Therefore, a blockchain-based dataauthorization device is formed from a logical perspective. Certainly, inaddition to the software implementation, one or more implementations ofthe present specification do not preclude other implementations, forexample, a logic device or a combination of software and hardware. Inother words, the execution entity of the following processing procedureis not limited to each logical unit, and can alternatively be hardwareor a logical device.

With reference to FIG. 13, in a software implementation, theblockchain-based data authorization apparatus can include the following:a receiving unit 1301, configured to enable a privacy computing platformto receive a data acquisition request initiated by a data user, wherethe data acquisition request corresponds to target data held by a dataowner; a query unit 1302, configured to enable the privacy computingplatform to submit an authentication transaction to a blockchain, wherethe authentication transaction is used to query whether the data userhas obtained authorization for the target data; an acquisition unit1303, configured to enable the privacy computing platform to obtain anauthorization token issued based on a data authorization smart contractinvoked by the authentication transaction; and a returning unit 1304,configured to enable the privacy computing platform to obtain the targetdata when the authorization token indicates that the data user hasobtained the authorization for the target data, to return, to the datauser, at least one of the target data or an operation result obtainedafter a predetermined operation is performed on the target data.

Optionally, the returning unit 1304 is configured to: enable the privacycomputing platform to obtain encrypted target data from a blockchainnode, where the encrypted target data is obtained after the target datais encrypted by using a public key of the data owner; and enable theprivacy computing platform to decrypt the encrypted target data by usinga hosted private key of the data owner, to obtain the target data.

Optionally, a blockchain node stores a digital digest of the targetdata, and the target data is stored in an off-chain channel by the dataowner; and the returning unit 1304 is configured to: enable the privacycomputing platform to provide the digital digest of the target data forthe off-chain channel; and enable the privacy computing platform toreceive the target data returned by the off-chain channel.

The system, apparatus, module or unit illustrated in the previousimplementations can be specifically implemented by a computer chip orentity, or can be implemented by a product having a function. A typicalimplementation device is a computer. The computer can be in the form ofa personal computer, a laptop computer, a cellular phone, a cameraphone, a smart phone, a personal digital assistant, a media player, anavigation device, an e-mail transceiver, a game console, a tabletcomputer, a wearable device, or any combination of several of thesedevices.

In a typical configuration, the computer includes one or more centralprocessing unit (CPU), input/output interfaces, network interfaces, andmemories.

The memory can include a non-permanent memory in a computer-readablemedium, a random access memory (RAM) and/or a non-volatile memory, forexample, a read-only memory (ROM) or a flash memory (flash RAM). Thememory is an example of a computer-readable medium.

The computer-readable media includes permanent and non-permanent media,and removable and non-removable media. Information storage can beimplemented by using any method or technology. Information can be acomputer readable instruction, a data structure, a program module, orother data. Examples of the computer storage medium include, but are notlimited to, a phase change memory (PRAM), a static random access memory(SRAM), a dynamic random access memory (DRAM), another type of RAM, aROM (ROM), an electrically erasable programmable ROM (EEPROM), a flashmemory or another memory technology, a compact disc ROM (CD-ROM), adigital versatile disk (DVD) or another optical storage, a magneticcassette, a magnetic disk storage, a quantum storage, a graphene-basedstorage medium, another magnetic storage device, or any othernon-transmission medium. The computer storage medium can be used tostore information accessible to a computing device. As described in thepresent application, the computer-readable medium does not includetransitory computer readable media, such as a modulated data signal andcarrier.

It is worthwhile to note that the term “include”, “comprise”, or theirany other variant is intended to cover non-exclusive inclusion so thatprocesses, methods, commodities, or devices that include a list ofelements include not only those elements but also other elements thatare not explicitly listed, or elements inherent in such processes,methods, commodities, or devices. Without more constraints, an elementpreceded by “includes a . . . ” does not preclude the existence ofadditional identical elements in the process, method, article, or devicethat includes the element.

The specific implementations of the present specification are describedin the above. Other implementations are within the scope of the appendedclaims. In some cases, the actions or steps described in the claims canbe performed in an order different from that in the implementations andcan still achieve the desired results. In addition, the process depictedin the accompanying drawings is not necessarily shown in a particularorder to achieve the desired results. In some implementations,multi-task processing and parallel processing are also possible or canbe advantageous.

The terms used in one or more implementations of the presentspecification are only for the purpose of describing a particularimplementation and are not intended to limit one or more implementationsof the present specification. The singular forms “one”, “said” and “the”used in one or more implementations of the present specification and theappended claims are also intended to include most forms unless thecontext clearly indicates other meanings. It should also be understoodthat the term “and/or” used in the present specification refers to anypossible combination or all possible combinations of one or moreassociated listed items.

It should be understood that, although the terms first, second and thirdmay be used in one or more implementations of the present specificationto describe a variety of information, such information should not belimited to those terms. These terms are used only to distinguish betweenthe same type of information. For example, without departing from thescope of one or more implementations of the present specification, firstinformation can also be referred to as second information, andsimilarly, second information can also be referred to as firstinformation. Depending on the context, for example, the term “if” usedhere can be interpreted as “in”, “when”, or “in response todetermining”.

The previous descriptions are merely preferred implementations of one ormore implementations of the present specification, and are not intendedto limit one or more implementations of the present specification. Anymodification, equivalent replacement, improvement, etc. made within thespirit and principles of one or more implementations of the presentspecification shall be included within the scope of the protection ofone or more implementations of the present specification.

What is claimed is:
 1. A blockchain-based data authorization method, comprising: receiving, by a blockchain node, an authentication transaction submitted by a privacy computing platform, wherein the authentication transaction queries whether a data user has obtained authorization of target data possessed by a data owner; invoking, by the blockchain node, a request interface defined in a smart contract, wherein an authorization request event is written into a transaction log in response to invoking the request interface, and wherein the transaction log is monitored by the data owner; in response to invoking the request interface, invoking, by the blockchain node, an authorization interface defined in the smart contract based on an authorization confirmation transaction submitted by the data owner in response to the authorization request event being written into the transaction log, wherein the authorization interface defined in the smart contract is configured to authorize the data user; updating, by the blockchain node, an authorization state of the data user based on the authorization interface defined in the smart contract; and in response to updating the authorization state of the data user, executing, by the blockchain node, the smart contract invoked by the authentication transaction to provide an authorization token to the privacy computing platform that instructs the privacy computing platform to obtain the target data, and send a computational result of one or more predetermined computational operations based on the target data to the data user.
 2. The method according to claim 1, wherein the smart contract comprises a list of authorized users including the data user.
 3. The method according to claim 1, wherein the request interface is invoked in response to receiving the authentication transaction.
 4. The method according to claim 1, wherein the authorization token indicates a quantity of authorizations the data user has over the target data and the smart contract includes one or more instructions to reduce the quantity of authorizations the data user has until the data user no longer has authorization.
 5. The method according to claim 1, wherein the smart contract is executed to provide the target data to the data user if the target data has low data privacy level, and the smart contract is executed to provide computational result of the one or more predetermined computational operations if the target data has high data privacy level.
 6. The method according to claim 1, further comprising: receiving, by the blockchain node, a depository transaction that includes ciphertext of the target data generated by encrypting the target data using a public key associated with the data owner; and storing, by the blockchain node, the ciphertext of the target data, wherein the privacy computing platform hosts a private key corresponding to the public key for decrypting the ciphertext of the target data.
 7. The method according to claim 1, further comprising: encrypting, by the blockchain node, the target data in a trusted execution environment (TEE) by using a public key associated with the data owner to obtain ciphertext of the target data; and storing, by the blockchain node, the ciphertext of the target data to a database associated with the blockchain node, and wherein the privacy computing platform hosts a private key corresponding to the public key associated with the data owner for decrypting the ciphertext of the target data.
 8. The method according to claim 7, further comprising: wherein a data acquisition transaction is a ciphertext of a privacy depository transaction, and executing the smart contract further comprises: decrypting the ciphertext in the TEE to obtain the target data.
 9. The method according to claim 1, wherein the blockchain node stores a digital digest of the target data, the target data is stored by the data owner in a storage media other than a blockchain, and is retrieved by another smart contract from the storage media and transferred to the smart contract to perform the one or more predetermined computational operations.
 10. The method according to claim 1, wherein the authorization token comprises a temporary session key, and at least one of the target data or the computational result is encrypted to ciphertext by using the temporary session key and transmitted to the data user through the privacy computing platform.
 11. The method according to claim 10, wherein the authorization token comprises a first field and a second field, and wherein the first field includes ciphertext of the temporary session key encrypted by using an encryption key associated with the data user, and the second field includes ciphertext of the temporary session key encrypted by using an encryption key associated with the privacy computing platform.
 12. A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising: receiving, by a blockchain node, an authentication transaction submitted by a privacy computing platform, wherein the authentication transaction queries whether a data user has obtained authorization of target data possessed by a data owner; invoking, by the blockchain node, a request interface defined in a smart contract, wherein an authorization request event is written into a transaction log in response to invoking the request interface, and wherein the transaction log is monitored by the data owner; in response to invoking the request interface, invoking, by the blockchain node, an authorization interface defined in the smart contract based on an authorization confirmation transaction submitted by the data owner in response to the authorization request event being written into the transaction log, wherein the authorization interface defined in the smart contract is configured to authorize the data user; updating, by the blockchain node, an authorization state of the data user based on the authorization interface defined in the smart contract; and in response to updating the authorization state of the data user, executing, by the blockchain node, the smart contract invoked by the authentication transaction to provide an authorization token to the privacy computing platform that instructs the privacy computing platform to obtain the target data, and send a computational result of one or more predetermined computational operations based on the target data to the data user.
 13. The medium according to claim 12, wherein the smart contract comprises a list of authorized users including the data user.
 14. The medium according to claim 12, wherein the request interface is invoked in response to receiving the authentication transaction.
 15. The medium according to claim 12, wherein the authorization token indicates a quantity of authorizations the data user has over the target data and the smart contract includes one or more instructions to reduce the quantity of authorizations the data user has until the data user no longer has authorization.
 16. The medium according to claim 12, wherein the smart contract is executed to provide the target data to the data user if the target data has low data privacy level, and the smart contract is executed to provide computational result of the one or more predetermined computational operations if the target data has high data privacy level.
 17. The medium according to claim 12, wherein the operations comprise: receiving, by the blockchain node, a depository transaction that includes ciphertext of the target data generated by encrypting the target data using a public key associated with the data owner; and storing, by the blockchain node, the ciphertext of the target data, wherein the privacy computing platform hosts a private key corresponding to the public key for decrypting the ciphertext of the target data.
 18. A computer-implemented system comprising: one or more processors; and one or more computer-readable memories coupled to the one or more processors and having instructions stored thereon that are executable by the one or more processors to perform one or more operations comprising: receiving, by a blockchain node, an authentication transaction submitted by a privacy computing platform, wherein the authentication transaction queries whether a data user has obtained authorization of target data possessed by a data owner; invoking, by the blockchain node, a request interface defined in a smart contract, wherein an authorization request event is written into a transaction log in response to invoking the request interface, and wherein the transaction log is monitored by the data owner; in response to invoking the request interface, invoking, by the blockchain node, an authorization interface defined in the smart contract based on an authorization confirmation transaction submitted by the data owner in response to the authorization request event being written into the transaction log, wherein the authorization interface defined in the smart contract is configured to authorize the data user; updating, by the blockchain node, an authorization state of the data user based on the authorization interface defined in the smart contract; and in response to updating the authorization state of the data user, executing, by the blockchain node, the smart contract invoked by the authentication transaction to provide an authorization token to the privacy computing platform that instructs the privacy computing platform to obtain the target data, and send a computational result of one or more predetermined computational operations based on the target data to the data user. 